package can.bishe.modules.senic.service.impl;

import can.bishe.common.utils.PageUtils;
import can.bishe.common.utils.Query;
import can.bishe.modules.senic.dao.SenicScoresDao;
import can.bishe.modules.senic.entity.SenicScoresEntity;
import can.bishe.modules.senic.service.SenicScoresService;
import com.baomidou.mybatisplus.plugins.pagination.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;
import java.util.Map;
import java.util.List;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;

@Service("senicScoresService")
public class SenicScoresServiceImpl extends ServiceImpl<SenicScoresDao, SenicScoresEntity>
        implements SenicScoresService {

    @Override
    public PageInfo queryPage(Map<String, Object> params) {
		int pageSize = Integer.valueOf(String.valueOf(params.get("limit")));
		int pageNum = Integer.valueOf(String.valueOf(params.get("page")));
		PageHelper.startPage(pageSize,pageNum);
		String username = (String) params.get("username");
		String senicName = (String) params.get("senicName");
		List<SenicScoresEntity> senicScoresEntities = this.baseMapper.getScoreOverviews(username,senicName);
		PageInfo page = new PageInfo(senicScoresEntities);
        return page;
    }

    @Override
    public List<Map<String,Object>> getSenicScoreInfo(Long senicId) {

        List<Map<String,Object>> scoreData = this.baseMapper.getScoresList(senicId);
        System.out.print("123");
        return scoreData;
    }

	@Override
	public List<Map<String, Object>> getMySenicScoreInfo(Long userId) {

		List<Map<String,Object>> scoreData = this.baseMapper.getMyScoresList(userId);

		return scoreData;
	}

	@Override
	public List<Long> getUserLoveList(Long userId) {
		// TODO Auto-generated method stub
		List<Long> resList = this.baseMapper.getUserLoveList(userId.longValue());
		return resList;
	}

	@Override
	public List<Long> getUserList() {
		List<Long> data = this.baseMapper.getUserList();
		return data;
	}

	@Override
	public List<Long> getSenicList(Long userId) {
		List<Long> data = this.baseMapper.getSenicList(userId);
		return data;
	}

}
